package edu.chl.grupp11.aegas.controller.imp;

import java.util.Observable;

import edu.chl.grupp11.aegas.controller.IConfigController;
import edu.chl.grupp11.aegas.model.AbstractConfig;
import edu.chl.grupp11.aegas.model.ConfigFactory;
import edu.chl.grupp11.aegas.view.SettingsBox;

public class ConfigController implements IConfigController {

	private AbstractConfig config;

	public ConfigController() {
		config = ConfigFactory.getSharedConfig();
	}

	@Override
	public void changeSettings(boolean settings) {
		config.setSearchSubFolders(settings);
	}

	@Override
	public void update(Observable obs, Object obj) {
		if (obs.getClass() == SettingsBox.class) {
			SettingsBox box = (SettingsBox) obs;
			changeSettings(box.getSearchSubFolders());
		}

	}
}
